/*
 * @Descripttion: 
 * @version: 
 * @Author: turingchang
 * @Date: 2020-09-03 22:17:46
 * @LastEditors: turingchang
 * @LastEditTime: 2020-09-08 14:57:19
 */

module.exports = app => {
    const {router,controller} = app;
    const adminRouter = router.namespace('/api/admin');
    adminRouter.get('/', controller.admin.admin.list);
    adminRouter.get('/list', controller.admin.admin.list);
    adminRouter.get('/info', controller.admin.admin.info);
    // adminRouter.get('/get', controller.admin.admin.get);

    // role
    adminRouter.get('/role/list', controller.admin.role.list);

    //permission
    adminRouter.get('/permission/menu/tree', controller.admin.permission.menuTree);
    adminRouter.get('/permission/menu/list/:pid', controller.admin.permission.getListByPid);
    adminRouter.get('/permission/:id', controller.admin.permission.get);
    adminRouter.post('/permission/add', controller.admin.permission.add);
    
    // adminRouter.post('/admin', controller.admin.admin.create);
    // adminRouter.get('/admin/:id', controller.admin.admin.detail);
    // adminRouter.post('/admin/:id', controller.admin.admin.update);
    // adminRouter.delete('/admin/:id', controller.admin.admin.delete);
    // adminRouter.get('/admin/list', controller.admin.admin.list);
    
    // router.redirect('/news/list','/news');//重定向使用router而不是adminRouter
} 